package com.itheima.web;

import com.itheima.daomain.User;
import com.itheima.service.deleteDServlet;
import org.apache.commons.beanutils.BeanUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;

/**
 * @Descriptionn:test
 * @Create by:依然
 * @Date:2021/11/3 9:39
 */
@WebServlet("/deleteUserByIDServlet")
public class DeleteUserByIDServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        deleteDServlet dServlet = new deleteDServlet();
        String id = request.getParameter("id");
        Integer deleteid = dServlet.deleteid(Integer.parseInt(id));
        if (deleteid > 0) {
            response.sendRedirect("/delete_ok.jsp");
        } else {

            System.out.println("删除失败");
        }
    }
}
